// 事件抽象类
// Created by taojiaheng on 2020/6/4.
//

#ifndef WEBSOCKETSERVER_EVENT_H
#define WEBSOCKETSERVER_EVENT_H
#include "../common/cdef.h"
class Connection;
class Event {
public:
    Event();
    ~Event();
    /**
     * 当数据响应时触发
     * @param client 链接对象
     * @param _buff 数据
     */
    virtual bool onMessage(Connection * client, BUFF * _buff) = 0;

    /**
     * 当链接连接时触发
     * @param client 链接对象
     */
    virtual void onConnect(Connection * client) = 0;

    /**
     * 当链接关闭时触发
     * @param client 链接对象
     */
    virtual void onClose(Connection * client) = 0;

    /**
     * 当协议握手成功时被触发
     * @param client
     */
    virtual void onProtocolConnect(Connection * client) = 0;
};


#endif //WEBSOCKETSERVER_EVENT_H
